package com.maigu.controller;

import ch.qos.logback.core.net.SyslogOutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import sun.misc.Contended;

/**
 * @author 水杯
 * @date 2020-05-04 11:47
 */
@RestController//如果每个功能返回的都是Restful内容，哪么可以使用该注解
public class SpringBootController {
    private Logger logger= LoggerFactory.getLogger(this.getClass());
   @RequestMapping("/hello")
   //返回的是Restfull内容，不使用该注解会进行跳转
   //@ResponseBody
    public String yes()
    {
        return "hello";
    }

    @RequestMapping("/ok")
    //返回的是Restfull内容，不使用该注解会进行跳转
    //@ResponseBody
    public String ok()
 {
     logger.debug("debug日志");
     logger.info("info日记");
     logger.warn("war日志");
     logger.error("error日志");
     return "ok";
 }
 //支持rest风格
 @RequestMapping("/info/{msg}")
 public String show(@PathVariable String msg)
 {
     return "show"+msg;
 }

}
